$(function () {
  // 二级联动
  $('.ta0111').hover(function () {
    $(this).children('.ta3001').show();
  }, function () {
    $(this).children('.ta3001').css('display', 'none');
  })

  // 渐变轮播
  $(function () {
    var timeJ = 3000;

    for (var i = 1; i <= $(".banner01").length; i++) {
      $(".ban0010").append('<a href="javascript:(void)"></a>');
    }

    $(".banner01").eq(0).show();

    $(".ban0010 a").eq(0).addClass("active");

    $(".ban0010 a").mousemove(function () {
      $(this).addClass("active").siblings().removeClass("active");

      $(".banner01").eq($(this).index()).stop().fadeIn(300).siblings()
        .stop().fadeOut(300);
    });
    var i = 0;
    var time = setInterval(move, timeJ);
    function move() {
      i++;
      if (i == $(".banner01").length) {
        i = 0;
      };
      $(".ban0010 a").eq(i)
        .addClass("active")
        .siblings()
        .removeClass("active");
      $(".banner01").eq(i).fadeIn(300).siblings().fadeOut(300);
    }
  });


  var data = [
    {
      id: 1001,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490169118213.jpg",
      nameD: "小米红米3s手机壳保护套红米3高配版指纹男女款潮版磨砂硬壳防摔 收藏截图 送大礼包",
      price: "¥15.90"
    },
    {
      id: 1002,
      img: "https://img14.360buyimg.com/n1/s300x300_jfs/t1/123512/13/9287/160399/5f2fd23eE1fa59971/32abc6e0ae1d8f4b.jpg",
      nameD: "得听格子衬衫女长袖2020秋季新款小清新韩版宽松百搭学生春秋装纯棉衬衫大码外套上衣女 天蓝色 M 1",
      price: "¥78.00"
    },
    {
      id: 1003,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490169186175.jpg",
      nameD: "韩都衣舍2017春装新款女装春款拼接喇叭长袖连衣裙中长款时尚韩版 领券立减/单件包邮/七天无理由退换",
      price: "¥118.00",
    },
    {
      id: 1004,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490169030833.jpg",
      nameD: "韩都衣舍2017韩版女装夏装新款时尚修身显瘦圆领条纹T恤OGY7711娋 显瘦版型 舒适面料 条纹元素",
      price: "¥88.00",
    },
    {
      id: 1005,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490169216444.jpg",
      nameD: "小米红米3s手机壳保护套红米3高配版指纹男女款潮版磨砂硬壳防摔 收藏截图 送大礼包",
      price: "¥15.90",
    },
    {
      id: 1006,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490169250846.jpg",
      nameD: "小米红米3s手机壳保护套红米3高配版指纹男女款潮版磨砂硬壳防摔 收藏截图 送大礼包",
      price: "¥15.90",
    },
    {
      id: 1007,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490169151126.jpg",
      nameD: "小米红米3s手机壳保护套红米3高配版指纹男女款潮版磨砂硬壳防摔 收藏截图 送大礼包",
      price: "¥15.90",
    },
    {
      id: 1008,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174894779.jpg",
      nameD: "小米红米3s手机壳保护套红米3高配版指纹男女款潮版磨砂硬壳防摔 收藏截图 送大礼包",
      price: "¥15.90",
    }
  ]


  var dataA = [
    {
      id: 1009,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174858999.jpg",
      nameD: "美的韩美格2017春秋新款修身大码蕾丝网纱打底衫女长袖薄款圆领女T恤 全店商品 二件减5元 三件减10",
      price: "¥68.00"
    },
  ]


  var dataB = [
    {
      id: 1010,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1489102753231.jpg",
      nameD: "华帝新款韩版chic学生宽松短款外套上衣字母长袖连帽套头卫衣女潮",
      price: "¥300.00"
    },
    {
      id: 1011,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174741051.jpg",
      nameD: "乐力初棉纯色圆领长袖T恤打底衫秋衣女上衣体恤女士修身打底衣春秋 挺拔有型 棉氨材质 柔软舒适 耐洗耐磨",
      price: "¥65.00"
    },
  ]


  var dataC = [
    {
      id: 1012,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1489102299856.jpg",
      nameD: "喜瑞新款学院风韩版时尚太空棉宽松长袖印花圆领卫衣女",
      price: "¥233.00"
    },
    {
      id: 1013,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174791219.jpg",
      nameD: "LG17年春夏新款百搭半身裙蛋糕裙 a字裙 裤裙伞裙大码裙子超短裙女 松紧腰围 带裤边打底衬 涤针织面料",
      price: "¥49.00"
    },
  ]

  var dataD = [
    {
      id: 1014,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174925807.jpg",
      nameD: "逸阳女裤春装新款韩版休闲裤女九分裤黑色弹力微喇叭裤子显瘦0032 浓郁复古风 修饰腿型 生而优雅",
      price: "¥158.00"
    },
  ]

  var data01 = [
    {
      id: 1015,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174414186.jpg",
      nameD: "康比特森马针织衫 冬季男圆领套头青年毛衣小清新线衫毛衫纯色韩版学生",
      price: "¥79.00"
    },
    {
      id: 1016,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174208112.jpg",
      nameD: "金利来森马夹克 2016冬装新款男士飞行夹克贴布绣立领休闲外套韩版潮流",
      price: "¥1992.90"
    },
  ]

  var data02 = [
    {
      id: 1017,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174241651.jpg",
      nameD: "康恩贝裤子男士哈伦裤春季新款2017束脚裤修身韩版潮流小脚裤男裤休闲裤 弹力",
      price: "¥99.00"
    },

  ]

  var data03 = [

  ]

  var data04 = [
    {
      id: 1018,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490173894447.jpg",
      nameD: "金奥力红叶伞遮阳伞防紫外线黑胶防晒晴雨两用太阳伞女糖果色折叠雨伞大 黑胶防晒 晴雨两用 糖果色 都市风情",
      price: "¥38.00"
    },
    {
      id: 1019,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490155369648.jpg",
      nameD: "匡威Apple/苹果 Apple Watch Series 2 智能手表42mm",
      price: "¥3188.00"
    },
    {
      id: 1020,
      img: "https://x.dscmall.cn/storage/images/201809/thumb_img/779_thumb_G_1536793964961.jpg",
      nameD: "杰克琼斯74超薄非球面镜片高度近视眼镜片近视镜片防蓝光配眼镜镜片加工 套餐价低至359元 6款镜架任您选",
      price: "¥399.00",
    },
    {
      id: 1021,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490173663577.jpg",
      nameD: "佳沪数码-华为男女韩版纯棉可爱冬季个性防尘情侣口罩保暖透气黑色时尚潮款春 15元一共2个口罩 防尘个性时尚",
      price: "¥15.00",
    },
    {
      id: 1022,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1489108087695.jpg",
      nameD: "美的【新品发售】 Beats Beats Solo3 Wireless 头戴式无线蓝牙耳机 分期免息 全国联保 免费保修一年",
      price: "¥1888.00",
    },
    {
      id: 1023,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490173534127.jpg",
      nameD: "姬芮NewEra纽亦华 新款MLB棒球帽男女字母NY洋基LA道奇调节平沿嘻哈帽 官方正品",
      price: "¥219.00",
    },
    {
      id: 1024,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490173699371.jpg",
      nameD: "健安喜宝石蝶真丝围巾女士春秋季高档丝巾重磅桑蚕丝大方巾披肩丝绸礼品 16姆米重磅真丝丝滑缎面90方巾礼盒包装",
      price: "¥169.00",
    },
    {
      id: 1025,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490173860746.jpg",
      nameD: "justyle6林志玲花样姐姐同款海伦凯勒太阳镜女 偏光蛤蟆镜潮墨镜H8535 花样姐姐同款 林志玲设计 炫彩镂空",
      price: "¥378.00",
    }
  ]

  var data05 = [

    {
      id: 1026,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490173534127.jpg",
      nameD: "姬芮NewEra纽亦华 新款MLB棒球帽男女字母NY洋基LA道奇调节平沿嘻哈帽 官方正品",
      price: "¥219.00",
    },

  ]
  var data06 = [


  ]


  var data07 = [
    {
      id: 1027,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1489099987431.jpg",
      nameD: "爆款 爱慕经典KiKi裤轻薄无痕女士中腰三角内裤多色内衣A",
      price: "¥88.00"
    },
    {
      id: 1028,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174547624.jpg",
      nameD: "狼爪贝妍夏季薄款女士睡衣性感V领女南韩丝家居服运动可外穿中袖套装",
      price: "¥138.00"
    },
    {
      id: 1029,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174469373.jpg",
      nameD: "兰蔻Calvin Klein Underwear/CK 2017春夏新款 男士平角内裤NU8638 初上市价格290元",
      price: "¥290.00",
    },
    {
      id: 1030,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174663688.jpg",
      nameD: "立邦都市丽人文胸旗舰店 林志玲有钢圈少女小胸文胸 聚拢 调整型内衣V 官方正品 赠运费险 收藏有礼 全国包邮",
      price: "¥69.00",
    },
    {
      id: 1031,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174703131.jpg",
      nameD: "李宁都市丽人一片式无痕文胸厚杯性感聚拢舒适光面胸罩纯色商场同款 2016新品明星同款舒适Q软托无痕体验",
      price: "¥91.00",
    },
    {
      id: 1032,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1489100049187.jpg",
      nameD: "Five Plus2017新品 加一尚品无痕内衣女 前扣无钢圈薄款交叉美背文胸M37 厚杯+薄杯 无钢圈 前扣 美背 上薄下厚",
      price: "¥158.00",
    },
    {
      id: 1033,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1489100653308.jpg",
      nameD: "新百伦樱尚雅一片式无痕无钢圈文胸聚拢调整型性感小胸罩厚薄款少女内衣 2件减5元 不聚拢包退 送运费险",
      price: "¥200.00",
    },
    {
      id: 1034,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1489100914563.jpg",
      nameD: "ELLE HOME舒适睡眠文胸罩无痕薄款运动内衣无钢圈女士调整型背心式少女聚拢 赠运费险 无痕无钢圈 舒适聚拢",
      price: "¥211.00",
    }
  ]

  var data08 = [

    {
      id: 1035,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490174508974.jpg",
      nameD: "Masentek迷瞳盒装女士内裤莫代尔透气少女三角裤夏季性感低腰无痕大码裤头 5条盒装 莫代尔面料 小内裤 窄边三角裤",
      price: "¥44.50",
    },

  ]

  var data09 = [


  ]

  var data10 = [
    {
      id: 1036,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490915538739.jpg",
      nameD: "阿迪达斯男鞋ZX750三叶草zx700跑",
      price: "¥400.00"
    },
    {
      id: 1037,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490218873837.jpg",
      nameD: "三星Nike 耐克官方 PRO COOL COMP LONG-SLEEVE 男子训练紧身衣703088",
      price: "¥249.00"
    },
    {
      id: 1038,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490218800612.jpg",
      nameD: "乔山洽福 转椅轮子万向轮 老板椅办公椅子滑轮电脑椅配件滚轮脚轮轱辘 静音灵活不伤地板质保三年下单备注安装方式",
      price: "¥23.80",
    },
    {
      id: 1039,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490218667022.jpg",
      nameD: "皮克朋马克华菲长袖T恤男 冬季新品纯棉圆领黑白潮款印花休闲t恤",
      price: "¥98.00",
    },
    {
      id: 1040,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490218770962.jpg",
      nameD: "七匹狼哑铃男士钢制家用电镀哑铃杠铃25 40公斤 纯钢哑铃盒装 健身器材 纯钢哑铃杠铃送哑铃架",
      price: "¥360.00",
    },
    {
      id: 1041,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490218732576.jpg",
      nameD: "苹果T1多功能健身器材家用仰卧板收腹机哑铃凳仰卧起坐板折叠 健身椅 进口格子皮八档调节 承重500斤",
      price: "¥260.00",
    },
    {
      id: 1042,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490218835060.jpg",
      nameD: "斯伯丁马克华菲长袖T恤男 冬季新品纯棉圆领黑白潮款印花休闲t恤",
      price: "¥98.00",
    },

  ]

  var data11 = [

    {
      id: 1043,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490218701469.jpg",
      nameD: "皮尔瑜伽迪卡侬健身手套 力量训练哑铃护掌防滑 DOMYOS QS 轻盈透气 重量训练",
      price: "¥39.90",
    },

  ]

  var data12 = [
    {
      id: 1044,
      img: "https://x.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1490218905472.jpg",
      nameD: "同庆和堂专业瑜伽服双线美背瑜伽背心吊带含胸垫122324",
      price: "¥159.00",
    },


  ]


  aA(data01);
  // zi("#q1",data01);
  aA(data);

  // 渲染
  function aA(data) {
    var str = '';
    data.forEach(function (v) {
      str += `
            <li class="btm-li">
                    <div class="btm-l-div">
                      <a href="#">
                        <img src="${v.img}" alt="">
                      </a>
                    </div>
                    <div class="name01">
                      <a href="#">
                        ${v.nameD}
                      </a>
                    </div>
                    <div class="d-price">
                      ${v.price}
                    </div>
                  </li>
            `;
    })
    $(".btm02").append(str);
  }

  // 切换 渲染
  function zi(t, data) {
    $(t).hover(function () {
      $(this).addClass('on');
      $(this).show().parents(".fl").find(".btm02 li").hide();
      aA(data);
    }
    // , function () {
    //   // $(t).removeClass('on');
    // }
    )
    
    // console.log($(t));
      var k =  $(t);
      $(t).mousemove(function(){
        if(k = this){
          console.log(9);
          $(this).addClass('on').siblings().removeClass('on');
        }
      })
  }
  zi("#qie1", data);
  zi("#qie2", dataA);
  zi("#qie3", dataB);
  zi("#qie4", dataC);
  zi("#qie5", dataD);





  zi("#q1", data01);
  zi("#q2", data02);
  zi("#q3", data03);



  zi("#w1", data04);
  zi("#w2", data05);
  zi("#w3", data06);

  zi("#e1", data07);
  zi("#e2", data08);
  zi("#e3", data09);

  zi("#r1", data10);
  zi("#r2", data11);
  zi("#r3", data12);



  // console.log($('.tia').offset().left);

  $('.bot1').hover(function () {
    $('.bot2,.bot3').show();
  }, function () {
    $('.bot2,.bot3').hide();
  })


  $('.bot2').click(function () {
    $('.aa').addClass('ans').siblings().removeClass('ans')
    $('.tia ul').animate({
      left: 0
    }, 500);
  })

  $('.bot3').click(function () {
    $('.bb').addClass('ans').siblings().removeClass('ans')
    $('.tia ul').animate({
      left: -1200
    }, 500);
  })

  $(".aa").click(function () {
    $('.aa').addClass('ans').siblings().removeClass('ans')
    $('.tia ul').animate({
      left: 0
    }, 500);
  })

  $(".bb").click(function () {
    $('.bb').addClass('ans').siblings().removeClass('ans')
    $('.tia ul').animate({
      left: -1200
    }, 500);
  })



  var flag = true;
  var itemTop = $('.hd').offset().top;

  //滚动事件 show 导航栏
  $(window).scroll(function () {
    var scrollD = $(window).scrollTop();
    // console.log(itemTop);
    // console.log(scrollD);

    // console.log($('.finally').offset().top);
    
    if (scrollD > itemTop) {
      $('.finally').fadeIn();
    } else {
      $('.finally').fadeOut();
    }

    var foot = $('.foot').offset().top;
    // console.log(foot);
    if (flag) {
      $('.floor .fl').each(function (i, ele) {
        if ($(document).scrollTop() >= $(ele).offset().top) {
          // console.log($(document).scrollTop());
          // console.log($(ele).offset().top);
          $('.fin1').eq(i + 1).addClass('out').siblings().removeClass('out');
        }



      })
    }
    
    //楼层导航
    // console.log($('.fin0 .fin1').offset().top);
    $('.fin0 .fin1').click(function () {

      // console.log($(this).index() - 1);
      flag = false;
      var ar = $(this).index() - 1;
      if (ar == -1) {
        ar = 0;
      }
      if (ar == 5) {
        ar = 4;
      }
      if (ar == 6) {
        sw = 0;
      }
      
      var cur = $(".floor .fl").eq(ar).offset().top;
      

      $('body, html').stop().animate({
        scrollTop: cur
      }, function () {
        flag = true;
      });



      $(this).addClass("fin1").siblings().removeClass("out");
    })




    if($('.finally').offset().top>=4580){
      // $('.fin0').css('display','none');
      $('.fin0').fadeOut();
    }else if($('.finally').offset().top<=4580){
      $('.fin0').fadeIn();
    }
  })






})